package com.lan.mock15.a;

import java.io.*;

public class Main {
	
	public static void main(String[] args) throws Exception {
		
		BufferedReader bfReader = new BufferedReader(new FileReader("D:\\log.txt"));
		String lineStr = null;
		long lastTime = 0;
		long maxRes = 0;
		long tmpRes = 0;
		
		while((lineStr = bfReader.readLine()) != null) {
			String[] list = lineStr.split(" ");
			if (list[0].equals(list[1])) {
				long curTime = Long.parseLong(list[2]);
				
				if (curTime - lastTime <= 1000) {
					tmpRes ++;
					if (tmpRes >= 2) {
						maxRes = Math.max(maxRes, tmpRes);
					}
				} else {
					tmpRes = 1;
				}
				
				lastTime = curTime;
			} else {
				tmpRes = 0;
				lastTime = 0;
			}
		}
		bfReader.close();
		System.out.println(maxRes);
	}
}
